<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<!DOCTYPE html>
<html>
	<head>
		<title>日志管理</title>
		<meta name="decorator" content="default"/>
		<script type="text/javascript">     
			$(function(){ 
				var defHeight = 300,wh=$(window).height();
				var lh=$('.location').height(),fh=$('#floatHead').height(),sh=$('.det-list').height(),ph=$('.pagelist').height();
				defHeight = (wh-lh-fh-sh-ph-130);
				$('.flexgrid').flexigrid({striped:true,height:defHeight});
			});
			
			function page(n,s){
				$("#pageNo").val(n);
				$("#pageSize").val(s);
				$("#searchForm").submit();
	        	return false;
	        }
	        
	        function deleteAll(){
				var ids =[];//定义一个数组    
	            $('input[name="checkall"]:checked').each(function(){    
	                ids.push($.trim($(this).val()));
	            });
	            document.location.href='${ctx}/sys/log/delete?ids='+ids;
			}
		</script>
	</head>
	<body>
		<sys:message content="${message}"/>
		<!--导航栏-->
		<div class="location">
			<a href="javascript:history.back(-1);" class="back"><i></i><span>返回上一页</span></a>
			<a href="${ctx}/center" class="home"><i></i>
			<span>首页</span></a> 
			<i class="arrow"></i> 
			<span>日志管理</span>
		</div>
		<!--/导航栏-->

		<!--工具栏-->
		<div id="floatHead" class="toolbar-wrap">
			<div class="toolbar">
				<div class="box-wrap">
					<a class="menu-btn"></a>
					<div class="l-list">
						<ul class="icon-list">
							<li><a class="all" href="javascript:;" onclick="checkAll(this);"><i></i><span>全选</span></a></li>
							<shiro:hasPermission name="sys:log:edit"><li><a class="add" href="${ctx}/sys/log/form"><i></i><span>新增</span></a></li></shiro:hasPermission>
							<shiro:hasPermission name="sys:log:edit"><li><a id="btnDelete" class="del" href="${ctx}/sys/log/delete?id=${log.id}" onclick="return confirma('确认要删除该日志吗？', deleteAll)"><i></i><span>删除</span></a></li></shiro:hasPermission>
						</ul>
					</div>
					<div class="r-list" style="display:none;">
						<input name="txtKeywords" type="text" id="txtKeywords" class="keyword" /> 
						<a id="lbtnSearch" class="btn-search" href="javascript:void(0)">查询</a>
					</div>
				</div>
			</div>
		</div>
		<!--/工具栏-->
		
		<!--搜索栏-->
		<form:form id="searchForm" modelAttribute="log" action="${ctx}/sys/log" method="post">
			<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
			<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
			<div class="det-list clearfix">
			    <div class="group btm">
					<div class="control">
			            <div class="title">日志类型</div>
			            <form:input path="type" htmlEscape="false" cssClass="input normal"/>
			        </div>
			    </div>   
			    <div class="group searchbtn">
			        <div class="btn-list">
			            <input type="submit" name="btnDetailedSearch" value="查询" id="btnDetailedSearch" class="btn">
			            <input name="btnReturn" type="reset" value="重置" class="btn yellow">
			        </div>
			    </div>
			    <div style="clear:both;"></div>
			</div>
		</form:form>
		<!--/搜索栏-->
		
		<!--列表-->
		<div class="table-container">
			<table class="flexgrid">
				<thead>
					<tr>
						<th width="25">选择</th>
						<th width="50">主键编号</th>
						<th width="70">日志类型</th>
						<th width="120">日志标题</th>
						<th width="40">结果</th>
						<th width="100">创建时间</th>
						<th width="100">openid</th>
						<th width="160">请求URI</th>
						<th width="30">方式</th>
						<th width="100">请求数据</th> 
						<th width="350">提示信息</th>
						<shiro:hasPermission name="sys:log:edit"><th width="30">操作</th></shiro:hasPermission>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${page.list}" var="log">
					<tr>
						<td style="text-align:center;">
							<span class="checkall" style="vertical-align: middle;">
								<input type="checkbox" name="checkall" value="${log.id}" />
							</span> 
							<%-- <input type="hidden" name="checkall" value="${log.id}" /> --%>
						</td>
						<td>${log.id}</td>
						<td>${log.type}</td>
						<td>${log.title}</td>
						
						<c:choose>
						   <c:when test="${log.outcome== 0}">  
							<td><p style="color:green">成功</p></td>  
						   </c:when>
						   <c:otherwise> 
							<td><p style="color:red">失败</p></td>  
						   </c:otherwise>
						</c:choose>							
						
						<td><fmt:formatDate value="${log.createDate}" pattern="yyyy-MM-dd HH:mm"/></td>
						<td>${log.remoteAddr}</td>
						<td>${log.requestUri}</td>
						<td>${log.method}</td>
						<td>${log.params}</td>
						<td>${log.exception}</td>
						<shiro:hasPermission name="sys:log:edit">
						<td align="center">
							<a href="${ctx}/sys/log/delete?id=${log.id}" onclick="return confirmx('确认要删除该日志吗？', this.href)">删除</a>
						</td>
						</shiro:hasPermission>
					</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
		<!--/列表-->

		<!--内容底部-->
		<div class="line10"></div>
		<div class="pagelist">
			${page}
		</div>
		<!--/内容底部-->
	</body>
</html>
